/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controlador;

import java.awt.CardLayout;
import javax.swing.JList;
import javax.swing.JPanel;
import modelo.SustratoNave;
import org.jfree.chart.ChartPanel;
import vista.graficas.GraficaHumedadActual;
import vista.panel.altas.AltaNave;
import vista.panel.altas.AltaNumeroSensoresGrupo;
import vista.panel.altas.AltaProducto;
import vista.panel.altas.AltaProductor;
import vista.panel.altas.AltaReferencia;
import vista.panel.altas.AltaSustrato;
import vista.panel.altas.AltaSustratoGrupo;
import vista.panel.altas.JPanelInicio;

/**
 *
 * @author Elias Mendoza
 */
public class EventoPanel {
  public JPanel panel;
  public JPanel contenedorPanel;
  
  public EventoPanel(JPanel contenedorPanel){
    this.contenedorPanel=contenedorPanel;
  }
  public EventoPanel(){
    
  }
  public void cargaPanelNave(){
    panel = (JPanel) new AltaNave();
    aderirPanel(panel);
  }
  public void cargaPanelProducto(){
    panel = (JPanel) new AltaProducto();
    aderirPanel(panel);
  }
  public void cargaPanelProductor(){
    panel = (JPanel) new AltaProductor();
    aderirPanel(panel);
  }
  public void cargaPanelReferencia(){
    panel = (JPanel) new AltaReferencia();
    aderirPanel(panel);
  }
  public void cargaPanelSustrato(){
    panel = (JPanel) new AltaSustrato(this);
    aderirPanel(panel);
  }
  public void cargaPanelSuatratoGrupo(EventoPanel cp,SustratoNave sn){
    panel = (JPanel) new AltaSustratoGrupo(cp,sn);
    aderirPanel(panel);
  }
  public void cargaPanelNumeroSensoresGrupo(SustratoNave sn,int [] grupos){
    panel = (JPanel) new AltaNumeroSensoresGrupo(sn,grupos);
    aderirPanel(panel);
  }
  public void cargaPanelGrafica1(ChartPanel panel){
      aderirPanel(panel);
  }
  public void cargaPanelInicio(JPanel contenedor){
    contenedorPanel = contenedor;
    panel = (JPanel) new JPanelInicio();
    aderirPanel(panel);
  }
  private void aderirPanel(JPanel p){
    p.setSize(contenedorPanel.getSize());
    contenedorPanel.add("panel",p);
    CardLayout cl = (CardLayout) contenedorPanel.getLayout();
    cl.show(contenedorPanel, "panel");
  }
  
  
}
